package ch.uzh.ifi.seal.ssqa.ui.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.swt.graphics.Color;

import ch.uzh.ifi.seal.ssqa.model.Source;

public class SourceFigure extends Figure {
	public static Color classColor = new Color(null, 255, 255, 206);
	public static Color inactive = new Color(null, 128, 128, 128);
	private CompartmentFigure attributeFigure = new CompartmentFigure();
	private CompartmentFigure methodFigure = new CompartmentFigure();

	public SourceFigure(Label name, Source object) {
		ToolbarLayout layout = new ToolbarLayout();
		setLayoutManager(layout);
		this.setSize(60, 30);
		setBorder(new LineBorder(ColorConstants.gray, 1));
		setBackgroundColor(classColor);
		setOpaque(true);
		name.setSize(60, 8);
		add(name);
		add(attributeFigure);
		add(methodFigure);
	}

	public CompartmentFigure getAttributesCompartment() {
		return attributeFigure;
	}

	public CompartmentFigure getMethodsCompartment() {
		return methodFigure;
	}
	
	public void setInactive(){
		this.setBackgroundColor(inactive);
	}
}
